/*
 * @Description:
 * @Author: HYH
 * @LastEditors: HYH
 * @LastEditTime: 2023-07-04 13:30:38
 */
import request from '@/utils/request'


/**
 * 报废sku
 * id：扫码的序列号
scrapType：扫码类型 1-运输报废 2-仓库报废
 * @param {*} params 
 * @returns 
 */
export function scrapSku(data) {
  return request({
    url: `/distribution/purchase/scrapSku`,
    method: 'POST',
    data
  })
}

/**获取sku扫码详情 */
export function getScanSerialInfo(params) {
  return request({
    url: `/distribution/purchase/getScanSerialInfo`,
    params
  })
}


/**获取序列号列表分页 */
export function getSkuSerializableListBySkuIdPurchaseIdByPage(params) {
  return request({
    url: `/distribution/purchase/getSkuSerializableListBySkuIdPurchaseIdByPage`,
    params
  })
}
/**通过采购单ID、SKU_ID查询SKU序列列表 */
export function getSkuSerializableListBySkuIdPurchaseId(params) {
  return request({
    url: `/distribution/purchase/getSkuSerializableListBySkuIdPurchaseId`,
    params
  })
}

/**分配序列号 */
export function distributionSerialNum(id) {
  return request({
    url: `/distribution/purchase/distributionSerialNum/${id}`,
    headers: {
      loading: true,
    }
  })
}

/**删除采购单*/
export function deletePurchase(ids) {
  return request({
    url: `/distribution/purchase/${ids}`,
    method: 'delete'
  })
}

/**批次装箱 */
export function batchEncasement(data) {
  return request({
    url: '/distribution/purchase/batchEncasement',
    method: 'post',
    data
  })
}

/**获取箱子号列表 */
export function getBatchBoxList(params) {
  return request({
    url: '/distribution/purchase/getBatchBoxList',
    method: 'get',
    params
  })
}

/**查询采购单列表-仓库 */
export function getPurchaseList(params) {
  return request({
    url: '/distribution/purchase/getPurchaseList',
    params
  })
}

/**查询批次列表-未分页 */
export function getBatchNoPage() {
  return request({
    url: '/distribution/batch/getBatchNoPage',

  })
}

/**仓库采购单确认收货*/
export function confirmReceiveGoods(data) {
  return request({
    url: '/distribution/purchase/confirmReceiveGoods',
    method: 'post',
    data
  })
}

// 扫码上架
export function purchaseSkuSerializableScanCode(params) {
  return request({
    url: '/distribution/purchase/purchaseSkuSerializableScanCode',
    params,
    method: 'get',
    repetitiveConfig:{
      neglectful:true,
      interval:3000
    }
  })
}

// 批量上架
export function purchaseSkuSerializableBatch(params) {
  return request({
    url: '/distribution/purchase/purchaseSkuSerializableBatch',
    params,
    method: 'get',
    headers: {
      loading: true,
    }
  })
}


// 继续分配序列号
export function distributionSerialNumContinue(params) {
  return request({
    url: '/distribution/purchase/distributionSerialNumContinue',
    params,
    method: 'get'
  })
}


// 删除序列号
export function deletePurchaseSkuSerializable(params) {
  return request({
    url: '/distribution/purchase/deletePurchaseSkuSerializable',
    params,
    method: 'get'
  })
}


/**批量设置sku序列过期时间*/
export function setIsExpiredTime(data) {
  return request({
    url: '/distribution/purchase/setIsExpiredTime',
    method: 'post',
    data
  })
}